/*
 * Created on 14.04.2011
 *
 * @author Benedikt
 *
 * createt first in Project Ch@t
 */

package listener;

import interfaces.Variablen;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import window.Fenster;
import window.SplitPanel;

public class MyActionListener implements ActionListener, Variablen {

	private static SplitPanel split;
	Fenster fenster;

	public MyActionListener(SplitPanel split, Fenster fenster) {
		MyActionListener.setSplit(split);
		this.fenster = fenster;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		String command = e.getActionCommand();

		if (command.equalsIgnoreCase("senden")) {

			System.out.println("Nachricht gesendet");
			getSplit().empfangArea.setText(getSplit().schreibenArea.getText());
			getSplit().scpEmpfang.updateUI();
			getSplit().schreibenArea.setText(null);
			getSplit().scpSchreiben.updateUI();
			getSplit().schreibenArea.requestFocus();

		}

	}

	public static void setSplit(SplitPanel split) {
		MyActionListener.split = split;
	}

	public static SplitPanel getSplit() {
		return split;
	}

}
